package com.lottery.ruok.lottrey.chat.model;

import android.app.Application;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.lottery.ruok.lottrey.MyApplication;
import com.lottery.ruok.lottrey.R;
import com.lottery.ruok.lottrey.retrofitModule.response.GetRoomAdminResponse;
import com.lottery.ruok.lottrey.userInfo.UserInfo;

import java.util.List;

import io.rong.imkit.model.UIMessage;
import io.rong.imkit.widget.AsyncImageView;
import io.rong.imkit.widget.ProviderContainerView;
import io.rong.imkit.widget.adapter.MessageListAdapter;

/**
 * 作者：lm
 * <p>
 * 创建日期：2018/9/15$
 * <p>
 * 描述：
 */
public class ConversionAdapterEx extends MessageListAdapter {

    public ConversionAdapterEx(Context context) {

        super(context);
    }

    @Override
    protected View newView(Context context, int position, ViewGroup group) {


        return super.newView(context, position, group);
    }

    @Override
    protected void bindView(View v, int position, UIMessage data) {

        super.bindView(v, position, data);
      if (  data.getConversationType().getName().equals("chatroom")) {
          ViewHolder holder = (ViewHolder) v.getTag();
          holder.nameView.setTextColor(Color.parseColor("#78707e"));
          if (data != null && UserInfo.roomManagers != null) {
              List<GetRoomAdminResponse.ListBean> listManagerBean = UserInfo.roomManagers;
              for (int i = 0; i < listManagerBean.size(); i++) {
                  GetRoomAdminResponse.ListBean bean = listManagerBean.get(i);
                  io.rong.imlib.model.UserInfo userInfo = data.getUserInfo();
                 if (userInfo!=null){
                     if (userInfo.getUserId().equals(bean.getRy_id())) {
                         if (userInfo != null) {
                             String name = "管理员-" + userInfo.getName();
                             holder.nameView.setText(name);
                             holder.nameView.setTextColor(Color.parseColor("#E94234"));
                         }
                     }
                 }

              }

          }
      }



    }

}
